<template>
  <div>
    <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-menu-item index="1">
        <router-link to="/" tag="span">首页</router-link>
      </el-menu-item>
      <el-submenu index="2">
        <template slot="title">
          <router-link to="/teacher/teacher_course/teacher_courseall"  tag="span">我的课程</router-link>
        </template>
        <el-menu-item index="2-1">
          <router-link to="/teacher/teacher_course/teacher_courseall"  tag="span">全部课程</router-link>
        </el-menu-item>
        <el-menu-item index="2-3">
          <router-link to="/teacher/teacher_course/teacher_coursecourse"  tag="span">课程</router-link>
        </el-menu-item>
        <el-menu-item index="2-2">
          <router-link to="/teacher/teacher_course/teacher_courselive"  tag="span">直播课程</router-link>
        </el-menu-item>
        <el-menu-item index="2-4">
          <router-link to="/teacher/teacher_course/teacher_coursepublish"  tag="span">发布课程</router-link>
        </el-menu-item>
      </el-submenu>


      <el-submenu index="3">
        <template slot="title">
          <router-link to="#" tag="span">我的消息</router-link>
        </template>
      </el-submenu>


      <el-submenu index="5">
        <template slot="title">
          <router-link to="/teacher/teacher_income/teacher_inincome" tag="span">收入记录</router-link>
        </template>
        <el-menu-item index="4-1">
          <router-link to="/teacher/teacher_income/teacher_inincome" tag="span">收入记录</router-link>
        </el-menu-item>
        <el-menu-item index="4-2">
          <router-link to="/teacher/teacher_income/teacher_inpay" tag="span">支出记录</router-link>
        </el-menu-item>
      </el-submenu>


      <el-submenu index="4">
        <template slot="title">
          <router-link to="/teacher/teacher_set/teacher_setinfo" tag="span">账号设置</router-link>
        </template>
        <el-menu-item index="4-1">
          <router-link to="/teacher/teacher_set/teacher_setinfo" tag="span">基本设置</router-link>
        </el-menu-item>
        <el-menu-item index="4-2">
          <router-link to="/teacher/teacher_set/teacher_setpayment" tag="span">支付设置</router-link>
        </el-menu-item>
        <el-menu-item index="4-3">
          <router-link to="/teacher/teacher_set/teacher_setauth" tag="span">身份认证</router-link>
        </el-menu-item>
<!--        <el-menu-item index="4-4">
          <router-link to="/teacher/teacher_set/teacher_setphone" tag="span">修改手机号</router-link>
        </el-menu-item>-->
<!--        <el-menu-item index="4-6">
          修改密码
        </el-menu-item>
        <el-menu-item index="4-6">
          修改头像
        </el-menu-item>-->
      </el-submenu>
    </el-menu>
    <ul id="nav">
      <router-view></router-view>
    </ul>

  </div>

</template>
<style scoped>
.el-header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>

<script>
export default {
  created() {
    //发送请求获取数据
    this.axios.get(this.baseUrl + "teacher/findById")
      .then(res => {
        //res.data   ResponseResult
        console.log(res.data.data);
        //
        this.$store.commit('setTeacher', res.data.data);
      });
    this.axios.get(this.baseUrl+"sale/findByUid")
      .then(res =>{
        console.log(res.data.data);
        //
        this.orders = res.data.data;
        let allmoney=0
        for (let i = 0; i < this.orders.length; i++) {
          allmoney+=this.orders[i].course.price;
        }
        this.$store.commit('setAllmoney', allmoney);
      });
  },
};
</script>
